of the object. The object's name is distin-guished from other variables by the a capital T (for Type) in front. Object Pascal doesn't require you to do this, but using this convention makes it easier to keep track of what are object types and what are not.
Example 1: A window object declaration in Object Pascal.
TWindow = object(TObject)
wPtr : WindowPtr;
function Open : Boolean;
procedure Draw;
procedure Close;
end;
In order to use a TWindow object, an instance of the
TWindow type
(alias class in
other OOP languages)
-- part contents for card part 1
----- text -----
to a window, it will use the data it contains to draw the contents of the window. If I tell it to close, it will doing whatever it needs to do to close. In fact, a pure OOP language will not allow you to access the data except through messages. Even though Object Pascal is not this strict, it is wise to show self-restraint and provide access procedures anyway.
An object definition in Object Pascal is an extension of the record type (see example 1 for the definition of a simple window object). Notice the use of the keyword "object" to tell the compiler that TWindow is an object and not a record. Just like a record, an object contains fields (called instance variables in OOPs lingo). However, an object also contains procedures or functions (called instance methods or more simply methods) which define the behavior